node {
  stage('git chekout') {
    checkout([$class                           : 'GitSCM',
              branches                         : [[name: "master"]],
              doGenerateSubmoduleConfigurations: false,
              extensions                       : [],
              gitTool                          : 'Default',
              submoduleCfg                     : [],
              userRemoteConfigs                : [[url: 'https://gitee.com/fastjrun/demo.git']]
    ])
  }
  stage('package Admin') {
    sh 'cd demo-admin && npm install && npm run build:prod'
  }
  stage('docker build & push') {
    sh 'mkdir -p output && rm -rf output/* && cp -r demo-admin/dist ./output &&' +
      'cp demo-admin/Dockerfile ./output && cp demo-admin/default.conf ./output'
    sh 'cd output && docker build . -t fastjrun/demo-admin:3.1'
  }
}
